/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.vote.service.impl;

import iaas.service.impl.BaseServiceImpl;

import java.util.Calendar;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.wealth.vote.entity.CooperativeRecord;
import com.wealth.vote.repository.CooperativeRecordDao;
import com.wealth.vote.service.ICooperativeRecordService;

/**
 * @author chan
 * @version 1.0
 * @since 1.0
 */
 
@Component
public class CooperativeRecordServiceImpl extends BaseServiceImpl<CooperativeRecord> implements ICooperativeRecordService{

	@Autowired
	private CooperativeRecordDao cooperativeRecordDao;

	@Override
	public List<CooperativeRecord> findByOpenid(String openid) throws Exception {
			//一天的开始时间
		   Calendar c1 =  Calendar.getInstance();  
		    c1.set(Calendar.HOUR_OF_DAY, 0);
		    c1.set(Calendar.MINUTE, 0);
		    c1.set(Calendar.SECOND, 0);
		    //一天的结束时间
		    Calendar c2 = Calendar.getInstance();  
		    c2.set(Calendar.HOUR_OF_DAY, 23);
		    c2.set(Calendar.MINUTE, 59);
		    c2.set(Calendar.SECOND, 59);
		return cooperativeRecordDao.findByOpenidAndCreateTimeBetween(openid, c1.getTime(), c2.getTime());
	}
	
	
}
